package com.meixun.xuanke.user.handler;

import com.meixun.xuanke.user.util.ResultUtil;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class MyExceptionHandler {

    @ResponseBody
    @ExceptionHandler(value = Exception.class)
    public String javaExceptionHandler(Exception ex) {
        //拦截请求异常，返回默认的系统异常失败
        return ResultUtil.getErrorjson("服务器异常，请稍后重试。");
    }
}
